//
//  ContentModeViewModel.swift
//  iPhone
//
//  Created by Toj on 6/12/23.
//

import UIKit

class ContentModeViewModel: NSObject {
    
    var cellModels: [UIContentModeCellModel] = []
    
    func setupCellModels() {
        let contentModes: [UIView.ContentMode] = [
            .scaleToFill, .scaleAspectFit, .scaleAspectFill,
            .redraw, .center, .top, .bottom, .left, .right,
            .topLeft, .topRight, .bottomLeft, .bottomRight
        ]
        
        let randomCount = UInt32(kImageURLs.count)
        let random = Int(arc4random_uniform(randomCount))
        let url = kImageURLs[random]
        
        var _cellModels: [UIContentModeCellModel] = []
        for contentMode in contentModes {
            let cellModel = UIContentModeCellModel(contentMode: contentMode)
            cellModel.url = url
            _cellModels.append(cellModel)
        }
        cellModels = _cellModels
    }
}
